﻿using System.IO;

namespace ErrorDumper.PropertyBinding {
    public class FileNotFoundExceptionPropertyBinder : IExceptionPropertyBinder {
        public ExceptionPropertyCollection BindProperties(
            ExceptionPropertyCollection properties, object instance) {

            var exception = instance as FileNotFoundException;
            if (exception == null)
                return null;

            if (properties == null)
                properties = new ExceptionPropertyCollection();
            if (!properties.Contains("FileName"))
                properties["FileName"] = exception.FileName;
            return properties;
        }
    }
}